home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / misc / volume25 / dvi / patch02 next >
Encoding:
Text File  |  1991-11-11  |  39.9 KB  |  1,393 lines

  1. Newsgroups: comp.sources.misc
  2. From: parag@hpsdeb.sde.hp.com (Parag Patel)
  3. Subject:  v25i039:  dvi - C++ DVI filter for HP LaserJets, Patch02
  4. Message-ID: <1991Nov10.195710.22829@sparky.imd.sterling.com>
  5. X-Md4-Signature: 32453f24e560e533d66a838e9ea184a7
  6. Date: Sun, 10 Nov 1991 19:57:10 GMT
  7. Approved: kent@sparky.imd.sterling.com
  8.  
  9. Submitted-by: parag@hpsdeb.sde.hp.com (Parag Patel)
  10. Posting-number: Volume 25, Issue 39
  11. Archive-name: dvi/patch02
  12. Environment: C++, LaserJet
  13. Patch-To: dvi: Volume 19, Issue 64-66
  14.  
  15. This is a mainly a bug-fix release, but adds one new feature.  dvi can
  16. now run a MakeTeXPK script to create missing fonts at on-the-fly, just
  17. like Tomas Rokicki's fine dvips package from labrea.stanford.edu.  A
  18. version of MakeTeXPK that's used within HP is included, but will
  19. doubtless require some hacking.
  20.  
  21.  From the README:
  22.  
  23. 1.8     use DVIFONTPATH env var instead of FONTPATH to search for fonts
  24.         try running a script which runs Metafont to generate fonts on the fly
  25.                 (this only works under Unix right now)
  26.         LaserJet+ cannot really handle 8-bit data - back to the old code
  27.         dvi -v runs properly when strings are put into read-only memory
  28.         Set -DUSE_DIRENT in the Makefile if you have <dirent.h> and not
  29.                 <ndir.h> or <sys/dir.h>
  30.         dvi compiles and runs using C++ 3.0 now
  31.  
  32. Many thanks to all the folks who sent in bug reports!
  33.  
  34.     -- Parag
  35.  
  36. ---- Cut Here and feed the following to sh ----
  37. #!/bin/sh
  38. # This is a shell archive (produced by shar 3.49)
  39. # To extract the files from this archive, save it to a file, remove
  40. # everything above the "!/bin/sh" line above, and type "sh file_name".
  41. #
  42. # made 10/22/1991 17:43 UTC by parag@hp-ses
  43. # Source directory /u1/parag/tools/tex/dvi
  44. #
  45. # existing files will NOT be overwritten unless -c is specified
  46. #
  47. # This shar contains:
  48. # length  mode       name
  49. # ------ ---------- ------------------------------------------
  50. #  34592 -rw-r--r-- patch-1.7-1.8
  51. #   2396 -r-xr-xr-x MakeTeXPK
  52. #
  53. # ============= patch-1.7-1.8 ==============
  54. if test -f 'patch-1.7-1.8' -a X"$1" != X"-c"; then
  55.     echo 'x - skipping patch-1.7-1.8 (File already exists)'
  56. else
  57. echo 'x - extracting patch-1.7-1.8 (Text)'
  58. sed 's/^X//' << 'SHAR_EOF' > 'patch-1.7-1.8' &&
  59. *** tmp/Makefile    Mon May 20 19:05:45 1991
  60. --- Makefile    Tue Oct 22 10:20:07 1991
  61. ***************
  62. *** 1,5
  63. X  # Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  64. ! # $Header: Makefile,v 1.24 91/05/20 20:05:44 hmgr Exp $
  65. X  
  66. X  CXX = CC
  67. X  .SUFFIXES: .C
  68. X
  69. --- 1,5 -----
  70. X  # Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  71. ! # $Header: Makefile,v 1.28 91/10/22 11:20:05 hmgr Exp $
  72. X  
  73. X  CXX = CC
  74. X  .SUFFIXES: .C
  75. ***************
  76. *** 10,15
  77. X  # -DBSD            for BSD derivatives
  78. X  # -DMSDOS        for Zortech C++ - also run "make msdos-files"
  79. X  # -DFREE_TAKES_CHAR    if you have a free(char*) instead of free(void*)
  80. X  # -DHP2686_FPATH=/path1:/path2:...
  81. X  #            to modify the default font search path
  82. X  CFLAGS = -g
  83. X
  84. --- 10,17 -----
  85. X  # -DBSD            for BSD derivatives
  86. X  # -DMSDOS        for Zortech C++ - also run "make msdos-files"
  87. X  # -DFREE_TAKES_CHAR    if you have a free(char*) instead of free(void*)
  88. + # -DUSE_DIRENT        use <dirent.h> instead of <ndir.h> or <sys/dir.h>
  89. + #
  90. X  # -DHP2686_FPATH=/path1:/path2:...
  91. X  #    to modify the default font search path for your system
  92. X  #
  93. ***************
  94. *** 11,17
  95. X  # -DMSDOS        for Zortech C++ - also run "make msdos-files"
  96. X  # -DFREE_TAKES_CHAR    if you have a free(char*) instead of free(void*)
  97. X  # -DHP2686_FPATH=/path1:/path2:...
  98. ! #            to modify the default font search path
  99. X  CFLAGS = -g
  100. X  LIBS = -lm
  101. X  
  102. X
  103. --- 13,25 -----
  104. X  # -DUSE_DIRENT        use <dirent.h> instead of <ndir.h> or <sys/dir.h>
  105. X  #
  106. X  # -DHP2686_FPATH=/path1:/path2:...
  107. ! #    to modify the default font search path for your system
  108. ! #
  109. ! # -DMF_SCRIPT=\"script\"
  110. ! #    where the usage is: script dpi bdpi magnification [mode]
  111. ! #    script tries to build the needed font on-the-fly
  112. ! #    you can use the "MakeTeXPK" script that comes with the dvips package
  113. ! #
  114. X  CFLAGS = -g
  115. X  LIBS = -lm
  116. X  
  117. ***************
  118. *** 19,25
  119. X      util.C global.C stack.C dirs.C dvi.C font.C readfont.C gffont.C \
  120. X      pkfont.C bitvec.C hp2684.h hp33440.h hp2686.h defs.h extern.h \
  121. X      dirs.h font.h dev.h darray.h boolean.h bitvec.h \
  122. !     ljdump.c
  123. X  
  124. X  OBJS = main.o dev.o hp2686.o hp33440.o hp2684.o util.o global.o stack.o \
  125. X      dirs.o dvi.o font.o readfont.o gffont.o pkfont.o bitvec.o
  126. X
  127. --- 27,33 -----
  128. X      util.C global.C stack.C dirs.C dvi.C font.C readfont.C gffont.C \
  129. X      pkfont.C bitvec.C hp2684.h hp33440.h hp2686.h defs.h extern.h \
  130. X      dirs.h font.h dev.h darray.h boolean.h bitvec.h \
  131. !     ljdump.c MakeTeXPK
  132. X  
  133. X  OBJS = main.o dev.o hp2686.o hp33440.o hp2684.o util.o global.o stack.o \
  134. X      dirs.o dvi.o font.o readfont.o gffont.o pkfont.o bitvec.o
  135. *** tmp/README    Thu May 23 10:45:10 1991
  136. --- README    Tue Oct 22 10:42:57 1991
  137. ***************
  138. *** 1,4
  139. ! $Header: README,v 1.15 91/05/23 11:45:11 hmgr Exp $
  140. X  
  141. X  Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  142. X  You can do what you wish with this as long as
  143. X
  144. --- 1,4 -----
  145. ! $Header: README,v 1.22 91/10/22 11:42:54 hmgr Exp $
  146. X  
  147. X  Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  148. X  You can do what you wish with this as long as
  149. ***************
  150. *** 59,64
  151. X  You will have to define -DMSDOS or -DBSD in the Makefile if you are on
  152. X  those systems.  My Sparc also needed -DFREE_TAKES_CHAR.
  153. X  
  154. X  Use "make ljdump" to build the "ljdump" program.  This is useful for
  155. X  debugging dvi by converting PCL to a semi-human-readable dump.
  156. X  
  157. X
  158. --- 59,75 -----
  159. X  You will have to define -DMSDOS or -DBSD in the Makefile if you are on
  160. X  those systems.  My Sparc also needed -DFREE_TAKES_CHAR.
  161. X  
  162. + You can make dvi run a script to build missing fonts on the fly.  Add
  163. + the -DMF_SCRIPT="script" definition in the Makefile if you want this.
  164. + The script is run as "script dpi bdpi magnification [mode]".
  165. + You can use the "MakeTeXPK" script that comes from the fine dvips
  166. + package by Tomas Rokicki at Stanford University.  dvips, which converts
  167. + DVI output to PostScript, may be ftp-ed from labrea.stanford.edu.  An
  168. + internal-HP version of MakeTeXPK is included with this package, though
  169. + it doubtless will need hacking to make it work on your system.  This
  170. + feature is unlikely to work on MSDOS.
  171. X  Use "make ljdump" to build the "ljdump" program.  This is useful for
  172. X  debugging dvi by converting PCL to a semi-human-readable dump.
  173. X  
  174. ***************
  175. *** 72,78
  176. X  available to others too.
  177. X  
  178. X  
  179. X      -- Parag Patel <parag@sde.hp.com>
  180. X  
  181. X  
  182. X
  183. --- 83,88 -----
  184. X  available to others too.
  185. X  
  186. X  
  187. X      -- Parag Patel <parag@sde.hp.com>
  188. X  
  189. X  
  190. ***************
  191. *** 79,85
  192. X  
  193. X  --------------------REVISION-INFO----------------------
  194. X  
  195. ! 1.6    released on HP INTERX Contrib Tape and comp.sources.misc
  196. X  
  197. X  1.7    first bug-fix release
  198. X      files modified: Makefile README extern.h main.C readfont.C hp2686.h
  199. X
  200. --- 89,95 -----
  201. X  
  202. X  --------------------REVISION-INFO----------------------
  203. X  
  204. ! 1.6    released on HP INTEREX Contrib Tape and comp.sources.misc
  205. X  
  206. X  1.7    first bug-fix release
  207. X      files modified: Makefile README extern.h main.C readfont.C hp2686.h
  208. ***************
  209. *** 87,89
  210. X      version string slightly modified so say_hello() in main.C works
  211. X      also look for fonts such as /path/cmr7.300pk and cmr7.300gf
  212. X      allow overriding default font search path from Makefile
  213. X
  214. --- 97,108 -----
  215. X      version string slightly modified so say_hello() in main.C works
  216. X      also look for fonts such as /path/cmr7.300pk and cmr7.300gf
  217. X      allow overriding default font search path from Makefile
  218. + 1.8    use DVIFONTPATH env var instead of FONTPATH to search for fonts
  219. +     try running a script which runs Metafont to generate fonts on the fly
  220. +         (this only works under Unix right now)
  221. +     LaserJet+ cannot really handle 8-bit data - back to the old code
  222. +     dvi -v runs properly when strings are put into read-only memory
  223. +     Set -DUSE_DIRENT in the Makefile if you have <dirent.h> and not
  224. +         <ndir.h> or <sys/dir.h>
  225. +     dvi compiles and runs using C++ 3.0 now
  226. *** tmp/dirs.C    Fri Feb 22 14:57:30 1991
  227. --- dirs.C    Mon Aug 19 16:45:52 1991
  228. ***************
  229. *** 1,5
  230. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  231. ! static const char rcsid[] = "$Header: dirs.C,v 1.10 91/02/22 15:57:16 hmgr Exp $";
  232. X  
  233. X  // read font directory names into memory for fast traversal
  234. X  //
  235. X
  236. --- 1,5 -----
  237. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  238. ! static const char rcsid[] = "$Header: dirs.C,v 1.11 91/08/19 17:45:50 hmgr Exp $";
  239. X  
  240. X  // read font directory names into memory for fast traversal
  241. X  //
  242. ***************
  243. *** 12,18
  244. X  #define    d_name    name
  245. X  #else
  246. X  #ifdef    BSD
  247. ! #include <sys/dir.h>
  248. X  #else
  249. X  #include <ndir.h>
  250. X  #endif
  251. X
  252. --- 12,18 -----
  253. X  #define    d_name    name
  254. X  #else
  255. X  #ifdef    BSD
  256. ! #  include <sys/dir.h>
  257. X  #else
  258. X  #  ifdef USE_DIRENT
  259. X  #      include <dirent.h>
  260. ***************
  261. *** 14,20
  262. X  #ifdef    BSD
  263. X  #include <sys/dir.h>
  264. X  #else
  265. ! #include <ndir.h>
  266. X  #endif
  267. X  #endif
  268. X  
  269. X
  270. --- 14,24 -----
  271. X  #ifdef    BSD
  272. X  #  include <sys/dir.h>
  273. X  #else
  274. ! #  ifdef USE_DIRENT
  275. ! #      include <dirent.h>
  276. ! #  else
  277. ! #      include <ndir.h>
  278. ! #  endif
  279. X  #endif
  280. X  #endif
  281. X  
  282. ***************
  283. *** 82,88
  284. X      for (FIND *ent = findfirst(dos_dirpath, FA_DIREC); ent != NULL;
  285. X          ent = findnext())
  286. X  #else
  287. !     for (direct * ent = readdir(dir); ent != NULL; ent = readdir(dir))
  288. X  #endif
  289. X      {
  290. X          char *s = strchr(ent->d_name, '.');
  291. X
  292. --- 86,96 -----
  293. X      for (FIND *ent = findfirst(dos_dirpath, FA_DIREC); ent != NULL;
  294. X          ent = findnext())
  295. X  #else
  296. ! #  ifdef USE_DIRENT
  297. !     for (dirent *ent = readdir(dir); ent != NULL; ent = readdir(dir))
  298. ! #  else
  299. !     for (direct *ent = readdir(dir); ent != NULL; ent = readdir(dir))
  300. ! #  endif
  301. X  #endif
  302. X      {
  303. X          char *s = strchr(ent->d_name, '.');
  304. *** tmp/dvi.1    Fri Feb 22 14:53:53 1991
  305. --- dvi.1    Mon Aug 19 16:41:17 1991
  306. ***************
  307. *** 1,5
  308. X  .\" Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  309. ! .\" $Header: dvi.1,v 1.29 91/02/22 15:53:38 hmgr Exp $
  310. X  .TH DVI 1 unsupported
  311. X  .ad b
  312. X  .SH NAME
  313. X
  314. --- 1,5 -----
  315. X  .\" Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  316. ! .\" $Header: dvi.1,v 1.30 91/08/19 17:41:15 hmgr Exp $
  317. X  .TH DVI 1 unsupported
  318. X  .ad b
  319. X  .SH NAME
  320. ***************
  321. *** 117,123
  322. X  should look for either the GF or PK format font files.
  323. X  The directories should have subdirectories for various magnifications.
  324. X  Overrides the value of the environment var
  325. ! .B FONTPATH
  326. X  if it exists.
  327. X  The separator between the various path is platform dependent.
  328. X  See the section on PLATFORM DEPENDENCIES for details.
  329. X
  330. --- 117,123 -----
  331. X  should look for either the GF or PK format font files.
  332. X  The directories should have subdirectories for various magnifications.
  333. X  Overrides the value of the environment var
  334. ! .B DVIFONTPATH
  335. X  if it exists.
  336. X  The separator between the various path is platform dependent.
  337. X  See the section on PLATFORM DEPENDENCIES for details.
  338. ***************
  339. *** 196,202
  340. X  It searches along a default directory path for a printer
  341. X  to find the necessary fonts.
  342. X  The environment variable
  343. ! .B FONTPATH
  344. X  or the
  345. X  .B \-d
  346. X  option
  347. X
  348. --- 196,202 -----
  349. X  It searches along a default directory path for a printer
  350. X  to find the necessary fonts.
  351. X  The environment variable
  352. ! .B DVIFONTPATH
  353. X  or the
  354. X  .B \-d
  355. X  option
  356. ***************
  357. *** 201,207
  358. X  .B \-d
  359. X  option
  360. X  may be used to override this if desired.
  361. ! The default FONTPATHs are listed in the PRINTER DEPENDENCIES section below.
  362. X  .PP
  363. X  The GF format is part of the normal output from the Metafont program.
  364. X  The PK format is a packed version of the GF file and is
  365. X
  366. --- 201,207 -----
  367. X  .B \-d
  368. X  option
  369. X  may be used to override this if desired.
  370. ! The default DVIFONTPATHs are listed in the PRINTER DEPENDENCIES section below.
  371. X  .PP
  372. X  The GF format is part of the normal output from the Metafont program.
  373. X  The PK format is a packed version of the GF file and is
  374. ***************
  375. *** 307,313
  376. X  Other commands may be supported in the future.
  377. X  .SH PLATFORM DEPENDENCIES
  378. X  The separator between the component parts
  379. ! in either the FONTPATH environment variable
  380. X  or the optional fontpath specification is platform dependent.
  381. X  Default separator for UNIX is the colon character,
  382. X  for MSDOS it is the semicolon character.
  383. X
  384. --- 307,313 -----
  385. X  Other commands may be supported in the future.
  386. X  .SH PLATFORM DEPENDENCIES
  387. X  The separator between the component parts
  388. ! in either the DVIFONTPATH environment variable
  389. X  or the optional fontpath specification is platform dependent.
  390. X  Default separator for UNIX is the colon character,
  391. X  for MSDOS it is the semicolon character.
  392. ***************
  393. *** 321,327
  394. X  .br
  395. X  Default options: page-reversal on, portrait
  396. X  .br
  397. ! Default FONTPATH for UNIX:
  398. X  /usr/lib/tex/fontbits/laser:/usr/lib/tex/fnt:/usr/local/tex/fontbits/laser
  399. X  .br
  400. X  Default FONTPATH for MSDOS:
  401. X
  402. --- 321,327 -----
  403. X  .br
  404. X  Default options: page-reversal on, portrait
  405. X  .br
  406. ! Default DVIFONTPATH for UNIX:
  407. X  /usr/lib/tex/fontbits/laser:/usr/lib/tex/fnt:/usr/local/tex/fontbits/laser
  408. X  .br
  409. X  Default DVIFONTPATH for MSDOS:
  410. ***************
  411. *** 324,330
  412. X  Default FONTPATH for UNIX:
  413. X  /usr/lib/tex/fontbits/laser:/usr/lib/tex/fnt:/usr/local/tex/fontbits/laser
  414. X  .br
  415. ! Default FONTPATH for MSDOS:
  416. X  /usr/lib/tex/fontbits/laser;/usr/lib/tex/fnt;/usr/local/tex/fontbits/laser
  417. X  .TP
  418. X  .B HP33440 LaserJetII ljII lj2 laser2 laserII default
  419. X
  420. --- 324,330 -----
  421. X  Default DVIFONTPATH for UNIX:
  422. X  /usr/lib/tex/fontbits/laser:/usr/lib/tex/fnt:/usr/local/tex/fontbits/laser
  423. X  .br
  424. ! Default DVIFONTPATH for MSDOS:
  425. X  /usr/lib/tex/fontbits/laser;/usr/lib/tex/fnt;/usr/local/tex/fontbits/laser
  426. X  .TP
  427. X  .B HP33440 LaserJetII ljII lj2 laser2 laserII default
  428. ***************
  429. *** 336,342
  430. X  .br
  431. X  Default options: page-reversal off, portrait
  432. X  .br
  433. ! Default FONTPATH: <same as LJ+>
  434. X  .TP
  435. X  .B HP33447 LaserJetIID ljIId lj2d laser2D laserIID
  436. X  HP LaserJetIID \-
  437. X
  438. --- 336,342 -----
  439. X  .br
  440. X  Default options: page-reversal off, portrait
  441. X  .br
  442. ! Default DVIFONTPATH: <same as LJ+>
  443. X  .TP
  444. X  .B HP33447 LaserJetIID ljIId lj2d laser2D laserIID
  445. X  HP LaserJetIID \-
  446. ***************
  447. *** 344,350
  448. X  .br
  449. X  Default options: page-reversal off, portrait, double-sided vertical binding
  450. X  .br
  451. ! Default FONTPATH: <same as LJ+>
  452. X  .TP
  453. X  .B HP2684 JumboJet lj2000 laser2000 lj2k
  454. X  HP LaserJet 2000 \-
  455. X
  456. --- 344,350 -----
  457. X  .br
  458. X  Default options: page-reversal off, portrait, double-sided vertical binding
  459. X  .br
  460. ! Default DVIFONTPATH: <same as LJ+>
  461. X  .TP
  462. X  .B HP2684 JumboJet lj2000 laser2000 lj2k
  463. X  HP LaserJet 2000 \-
  464. ***************
  465. *** 353,359
  466. X  .br
  467. X  Default options: page-reversal off, portrait, double-sided vertical binding
  468. X  .br
  469. ! Default FONTPATH: <same as LJ+>
  470. X  .SH FILES
  471. X  .nf
  472. X  /usr/lib/tex/fontbits/<printer>/<magdirs>/<PK fonts>
  473. X
  474. --- 353,359 -----
  475. X  .br
  476. X  Default options: page-reversal off, portrait, double-sided vertical binding
  477. X  .br
  478. ! Default DVIFONTPATH: <same as LJ+>
  479. X  .SH FILES
  480. X  .nf
  481. X  /usr/lib/tex/fontbits/<printer>/<magdirs>/<PK fonts>
  482. *** tmp/dvi.C    Fri Feb 22 14:57:47 1991
  483. --- dvi.C    Mon Aug 19 16:46:03 1991
  484. ***************
  485. *** 1,5
  486. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  487. ! static const char rcsid[] = "$Header: dvi.C,v 1.24 91/02/22 15:57:33 hmgr Exp $";
  488. X  
  489. X  // dvi scanning routines
  490. X  //
  491. X
  492. --- 1,5 -----
  493. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  494. ! static const char rcsid[] = "$Header: dvi.C,v 1.25 91/08/19 17:46:00 hmgr Exp $";
  495. X  
  496. X  // dvi scanning routines
  497. X  //
  498. *** tmp/extern.h    Fri May 17 15:28:16 1991
  499. --- extern.h    Thu Oct 10 10:15:55 1991
  500. ***************
  501. *** 1,5
  502. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  503. ! // $Header: extern.h,v 1.25 91/05/17 16:28:17 hmgr Exp $
  504. X  
  505. X  // externs for various LaserJet+ DVI filter functions
  506. X  //
  507. X
  508. --- 1,5 -----
  509. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  510. ! // $Header: extern.h,v 1.26 91/09/13 16:14:20 hmgr Exp $
  511. X  
  512. X  // externs for various LaserJet+ DVI filter functions
  513. X  //
  514. ***************
  515. *** 94,100
  516. X  #if FREE_TAKES_CHAR
  517. X  inline void  strfree(const char *s) { if (s != NULL) free((char *)s); }
  518. X  #else
  519. ! inline void  strfree(const char *s) { if (s != NULL) free((const void *)s); }
  520. X  #endif
  521. X  inline char *strdup(const char *s)
  522. X      { return s != NULL ? strcpy((char*)malloc(strlen(s) + 1), s) : NULL; }
  523. X
  524. --- 94,100 -----
  525. X  #if FREE_TAKES_CHAR
  526. X  inline void  strfree(const char *s) { if (s != NULL) free((char *)s); }
  527. X  #else
  528. ! inline void  strfree(const char *s) { if (s != NULL) free((void *)s); }
  529. X  #endif
  530. X  inline char *strdup(const char *s)
  531. X      { return s != NULL ? strcpy((char*)malloc(strlen(s) + 1), s) : NULL; }
  532. *** tmp/gffont.C    Fri Feb 22 14:58:20 1991
  533. --- gffont.C    Mon Aug 19 16:45:55 1991
  534. ***************
  535. *** 1,5
  536. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  537. ! static const char rcsid[] = "$Header: gffont.C,v 1.20 91/02/22 15:58:04 hmgr Exp $";
  538. X  
  539. X  // read font data from the METAFONT GF (generic font) files
  540. X  //
  541. X
  542. --- 1,5 -----
  543. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  544. ! static const char rcsid[] = "$Header: gffont.C,v 1.21 91/08/19 17:45:52 hmgr Exp $";
  545. X  
  546. X  // read font data from the METAFONT GF (generic font) files
  547. X  //
  548. ***************
  549. *** 85,95
  550. X  
  551. X      long dsize = getsval(4, fp);
  552. X      debug(4, "GF designsize=%ld", dsize);
  553. !     if (f.basename != NULL && dsize >> 4 != f.designsize)
  554. !     if (dochecksum && dsize != 0 && f.designsize != 0)
  555. !         quit("Designsize in DVI and GF file %s does not match", f.path);
  556. !     else
  557. !         warn("Designsize in DVI and GF file %s does not match", f.path);
  558. X  
  559. X      // check the checksum (!)
  560. X      long check = getuval(4, fp);
  561. X
  562. --- 85,91 -----
  563. X  
  564. X      long dsize = getsval(4, fp);
  565. X      debug(4, "GF designsize=%ld", dsize);
  566. !     // do not bother checking the designsize - it seems pointless
  567. X  
  568. X      // check the checksum (!)
  569. X      long check = getuval(4, fp);
  570. *** tmp/global.C    Fri Feb 22 14:57:10 1991
  571. --- global.C    Mon Aug 19 16:42:34 1991
  572. ***************
  573. *** 1,5
  574. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  575. ! static const char rcsid[] = "$Header: global.C,v 1.24 91/02/22 15:56:57 hmgr Exp $";
  576. X  
  577. X  // Global variables for DVI filter.
  578. X  // All globally visible variables are here.
  579. X
  580. --- 1,5 -----
  581. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  582. ! static const char rcsid[] = "$Header: global.C,v 1.25 91/08/19 17:42:32 hmgr Exp $";
  583. X  
  584. X  // Global variables for DVI filter.
  585. X  // All globally visible variables are here.
  586. ***************
  587. *** 119,125
  588. X      char *str;
  589. X      if (fontpath == NULL)
  590. X      {
  591. !     str = getenv("FONTPATH");
  592. X      if (str != NULL && *str != '\0')
  593. X          fontpath = str;
  594. X      }
  595. X
  596. --- 119,127 -----
  597. X      char *str;
  598. X      if (fontpath == NULL)
  599. X      {
  600. !     str = getenv("DVIFONTPATH");
  601. !     if (str == NULL || *str == '\0')
  602. !         str = getenv("FONTPATH");    // for backward-compatibility - sorry!
  603. X      if (str != NULL && *str != '\0')
  604. X          fontpath = str;
  605. X      }
  606. *** tmp/hp2686.C    Fri Feb 22 14:56:06 1991
  607. --- hp2686.C    Mon Aug 19 16:46:06 1991
  608. ***************
  609. *** 1,5
  610. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  611. ! static const char rcsid[] = "$Header: hp2686.C,v 1.20 91/02/22 15:55:21 hmgr Exp $";
  612. X  
  613. X  // HP2686 LaserJet+ and LaserJetII device-specific functions.
  614. X  // The various Reference Manuals should be consulted for more
  615. X
  616. --- 1,5 -----
  617. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  618. ! static const char rcsid[] = "$Header: hp2686.C,v 1.21 91/08/19 17:46:04 hmgr Exp $";
  619. X  
  620. X  // HP2686 LaserJet+ and LaserJetII device-specific functions.
  621. X  // The various Reference Manuals should be consulted for more
  622. ***************
  623. *** 66,74
  624. X  //
  625. X  const char *HP2686::char2dev(int ch, int &len)
  626. X  {
  627. !     static char buf[20];
  628. !     if ((ch >= 32 && ch <= 127) || ch >= 160)
  629. !     sprintf(buf, "%c", ch);
  630. X      else
  631. X      sprintf(buf, "\033&p1X%c", ch);
  632. X      len = strlen(buf);
  633. X
  634. --- 66,82 -----
  635. X  //
  636. X  const char *HP2686::char2dev(int ch, int &len)
  637. X  {
  638. !     static char buf[2];
  639. !     // the LaserJet Plus can't really handle full 8-bit fonts.
  640. !     // it can handle only character codes 33-127 and 160-255
  641. !     // we'll map as many of these as possible on a lowest-code first basis
  642. !     buf[0] = buf[1] = 0;
  643. !     if (ch <= 32)
  644. !     buf[0] = ch + 160;
  645. !     else if (ch > 32 && ch <= 127)
  646. !     buf[0] = ch;
  647. !     else if (ch <= 190)
  648. !     buf[0] = ch + 65;
  649. X      else
  650. X      quit("LaserJet+ cannot handle true 8-bit fonts -- Sorry");
  651. X      len = 1;
  652. ***************
  653. *** 70,79
  654. X      if ((ch >= 32 && ch <= 127) || ch >= 160)
  655. X      sprintf(buf, "%c", ch);
  656. X      else
  657. !     sprintf(buf, "\033&p1X%c", ch);
  658. !     len = strlen(buf);
  659. !     if (ch == 0)
  660. !     len++;
  661. X      return buf;
  662. X  }
  663. X  
  664. X
  665. --- 78,85 -----
  666. X      else if (ch <= 190)
  667. X      buf[0] = ch + 65;
  668. X      else
  669. !     quit("LaserJet+ cannot handle true 8-bit fonts -- Sorry");
  670. !     len = 1;
  671. X      return buf;
  672. X  }
  673. X  
  674. ***************
  675. *** 219,227
  676. X  // 
  677. X  void HP2686::downchar(font &f, fontchar &g, int ch)
  678. X  {
  679. !     // describe the character and its font to the LaserJet
  680. !     printf("\033*c%ldd%dE", f.num, ch);
  681. !     downljchar(f, g, ch);
  682. X  }
  683. X  
  684. X  // this sets up this character in the LaserJet memory so that
  685. X
  686. --- 225,249 -----
  687. X  // 
  688. X  void HP2686::downchar(font &f, fontchar &g, int ch)
  689. X  {
  690. !     // describe the character and its font to the LaserJet Plus
  691. !     // remember, only codes 33-127 and 160-255 can be sent
  692. !     if (ch <= 32)
  693. !     {
  694. !     printf("\033*c%ldd%dE", f.num, ch + 160);
  695. !     downljchar(f, g, ch + 160);
  696. !     }
  697. !     else if (ch > 32 && ch <= 127)
  698. !     {
  699. !     printf("\033*c%ldd%dE", f.num, ch);
  700. !     downljchar(f, g, ch);
  701. !     }
  702. !     else if (ch <= 190)
  703. !     {
  704. !     printf("\033*c%ldd%dE", f.num, ch + 65);
  705. !     downljchar(f, g, ch + 65);
  706. !     }
  707. !     else
  708. !     quit("LaserJet+ cannot handle true 8-bit fonts -- Sorry!");
  709. X  }
  710. X  
  711. X  // this sets up this character in the LaserJet memory so that
  712. *** tmp/hp33440.C    Fri Feb 22 14:56:34 1991
  713. --- hp33440.C    Mon Aug 19 16:45:57 1991
  714. ***************
  715. *** 1,5
  716. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  717. ! // $Header: hp33440.C,v 1.13 91/02/22 15:56:21 hmgr Exp $
  718. X  
  719. X  // LaserJetII series device-specific functions.
  720. X  // The LaserJetII Reference Manual should be consulted for more
  721. X
  722. --- 1,5 -----
  723. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  724. ! // $Header: hp33440.C,v 1.15 91/08/19 17:45:54 hmgr Exp $
  725. X  
  726. X  // LaserJetII series device-specific functions.
  727. X  // The LaserJetII Reference Manual should be consulted for more
  728. ***************
  729. *** 16,22
  730. X  
  731. X  // initialize the LaserJet II
  732. X  HP33440::HP33440() :
  733. !     HP2686(257, 256, 32, 32, 300, HP2686_HOFFSET, HP2686_VOFFSET,
  734. X              -128, 127, -128, 127, 128, 128, HP2686_FPATH)
  735. X  {
  736. X  }
  737. X
  738. --- 16,22 -----
  739. X  
  740. X  // initialize the LaserJet II
  741. X  HP33440::HP33440() :
  742. !     HP2686(257, 256, 16, 32, 300, HP2686_HOFFSET, HP2686_VOFFSET,
  743. X              -128, 127, -128, 127, 128, 128, HP2686_FPATH)
  744. X  {
  745. X  }
  746. ***************
  747. *** 19,24
  748. X      HP2686(257, 256, 32, 32, 300, HP2686_HOFFSET, HP2686_VOFFSET,
  749. X              -128, 127, -128, 127, 128, 128, HP2686_FPATH)
  750. X  {
  751. X  }
  752. X  
  753. X  // LaserJetIID:
  754. X
  755. --- 19,49 -----
  756. X      HP2686(257, 256, 16, 32, 300, HP2686_HOFFSET, HP2686_VOFFSET,
  757. X              -128, 127, -128, 127, 128, 128, HP2686_FPATH)
  758. X  {
  759. + }
  760. + // convert a character number to something that the device can deal with
  761. + // for a LaserJet II
  762. + //
  763. + const char *HP33440::char2dev(int ch, int &len)
  764. + {
  765. +     static char buf[20];
  766. +     if ((ch >= 32 && ch <= 127) || ch >= 160)
  767. +     sprintf(buf, "%c", ch);
  768. +     else
  769. +     sprintf(buf, "\033&p1X%c", ch);
  770. +     len = strlen(buf);
  771. +     if (ch == 0)
  772. +     len++;
  773. +     return buf;
  774. + }
  775. + // download a character for a particular font for the LaserJet II
  776. + // 
  777. + void HP33440::downchar(font &f, fontchar &g, int ch)
  778. + {
  779. +     // describe the character and its font to the LaserJet II
  780. +     printf("\033*c%ldd%dE", f.num, ch);
  781. +     downljchar(f, g, ch);
  782. X  }
  783. X  
  784. X  // LaserJetIID:
  785. *** tmp/hp33440.h    Fri Feb 22 14:58:53 1991
  786. --- hp33440.h    Mon Aug 19 16:46:12 1991
  787. ***************
  788. *** 1,5
  789. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  790. ! // $Header: hp33440.h,v 1.8 91/02/22 15:58:41 hmgr Exp $
  791. X  
  792. X  // LaserJetII series device-specific definitions.
  793. X  // The LaserJetII Reference Manual should be consulted for more
  794. X
  795. --- 1,5 -----
  796. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  797. ! // $Header: hp33440.h,v 1.9 91/08/19 17:46:06 hmgr Exp $
  798. X  
  799. X  // LaserJetII series device-specific definitions.
  800. X  // The LaserJetII Reference Manual should be consulted for more
  801. ***************
  802. *** 16,23
  803. X      HP33440(int maxf, int maxc, int maxpg, int maxld, int res,
  804. X              int ho, int vo, int fhmn, int fhmx, int fvmn, int fvmx,
  805. X              int fwd, int fhg, char *deffp) :
  806. !     HP2686(maxf, maxc, maxpg, maxld, res, ho, vo,
  807. !         fhmn, fhmx, fvmn, fvmx, fwd, fhg, deffp) { }
  808. X  public:
  809. X      HP33440();
  810. X  };
  811. X
  812. --- 16,23 -----
  813. X      HP33440(int maxf, int maxc, int maxpg, int maxld, int res,
  814. X              int ho, int vo, int fhmn, int fhmx, int fvmn, int fvmx,
  815. X              int fwd, int fhg, char *deffp) :
  816. !         HP2686(maxf, maxc, maxpg, maxld, res, ho, vo,
  817. !             fhmn, fhmx, fvmn, fvmx, fwd, fhg, deffp) { }
  818. X  public:
  819. X      const char *char2dev(int ch, int &len);
  820. X      void downchar(font &f, fontchar &g, int ch);
  821. ***************
  822. *** 19,24
  823. X      HP2686(maxf, maxc, maxpg, maxld, res, ho, vo,
  824. X          fhmn, fhmx, fvmn, fvmx, fwd, fhg, deffp) { }
  825. X  public:
  826. X      HP33440();
  827. X  };
  828. X  
  829. X
  830. --- 19,26 -----
  831. X          HP2686(maxf, maxc, maxpg, maxld, res, ho, vo,
  832. X              fhmn, fhmx, fvmn, fvmx, fwd, fhg, deffp) { }
  833. X  public:
  834. +     const char *char2dev(int ch, int &len);
  835. +     void downchar(font &f, fontchar &g, int ch);
  836. X      HP33440();
  837. X  };
  838. X  
  839. *** tmp/main.C    Fri May 17 15:28:21 1991
  840. --- main.C    Fri Sep 27 15:13:37 1991
  841. ***************
  842. *** 1,5
  843. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  844. ! static const char rcsid[] = "$Header: main.C,v 1.32 91/05/17 16:28:22 hmgr Exp $";
  845. X  
  846. X  // TeX DVI filter main() - just parses arguments and calls functions
  847. X  //
  848. X
  849. --- 1,5 -----
  850. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  851. ! static const char rcsid[] = "$Header: main.C,v 1.33 91/08/19 17:45:57 hmgr Exp $";
  852. X  
  853. X  // TeX DVI filter main() - just parses arguments and calls functions
  854. X  //
  855. ***************
  856. *** 7,13
  857. X  
  858. X  #include "defs.h"
  859. X  
  860. ! static char *const whatid = "@(#)dvi 1.7 (02 April 1991)";
  861. X  
  862. X  static void say_hello()
  863. X  {
  864. X
  865. --- 7,13 -----
  866. X  
  867. X  #include "defs.h"
  868. X  
  869. ! static char *const whatid = "@(#)dvi 1.8 (19 August 1991)";
  870. X  
  871. X  static void say_hello()
  872. X  {
  873. ***************
  874. *** 13,18
  875. X  {
  876. X      // hello message like (but unlike) TeX - the following mess should
  877. X      // strip out the revision number out of the build ID string "whatid"
  878. X      char *s = strchr(whatid, ' ');
  879. X      while (*s == ' ')
  880. X      s++;
  881. X
  882. --- 13,19 -----
  883. X  {
  884. X      // hello message like (but unlike) TeX - the following mess should
  885. X      // strip out the revision number out of the build ID string "whatid"
  886. +     mesg("TeX DVI filter version ");
  887. X      char *s = strchr(whatid, ' ');
  888. X      while (*s == ' ')
  889. X      s++;
  890. ***************
  891. *** 16,26
  892. X      char *s = strchr(whatid, ' ');
  893. X      while (*s == ' ')
  894. X      s++;
  895. !     char *t = s;
  896. !     while (*t != ' ' && *t != '$' && *t != '\0')
  897. !     t++;
  898. !     *t = '\0';
  899. !     mesg("TeX DVI filter version %s for ", s);
  900. X  }
  901. X  
  902. X  static long strtonum(char *s, char **ptr)
  903. X
  904. --- 17,25 -----
  905. X      char *s = strchr(whatid, ' ');
  906. X      while (*s == ' ')
  907. X      s++;
  908. !     while (*s != ' ' && *s != '$' && *s != '\0')
  909. !     mesg("%c", *s++);
  910. !     mesg(" for ");
  911. X  }
  912. X  
  913. X  static long strtonum(char *s, char **ptr)
  914. *** tmp/pkfont.C    Fri Feb 22 14:58:33 1991
  915. --- pkfont.C    Mon Aug 19 16:46:18 1991
  916. ***************
  917. *** 1,5
  918. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  919. ! static const char rcsid[] = "$Header: pkfont.C,v 1.21 91/02/22 15:58:17 hmgr Exp $";
  920. X  
  921. X  // read font data from the METAFONT PK (packed font) files
  922. X  //
  923. X
  924. --- 1,5 -----
  925. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  926. ! static const char rcsid[] = "$Header: pkfont.C,v 1.22 91/08/19 17:46:14 hmgr Exp $";
  927. X  
  928. X  // read font data from the METAFONT PK (packed font) files
  929. X  //
  930. ***************
  931. *** 67,77
  932. X  
  933. X      long dsize = getsval(4, fp);
  934. X      debug(4, "PK designsize=%ld", dsize);
  935. !     if (f.basename != NULL && dsize >> 4 != f.designsize)
  936. !     if (dochecksum && dsize != 0 && f.designsize != 0)
  937. !         quit("Designsize in DVI and PK file %s does not match", f.path);
  938. !     else
  939. !         warn("Designsize in DVI and PK file %s does not match", f.path);
  940. X  
  941. X      // check the checksum
  942. X      long check = getuval(4, fp);
  943. X
  944. --- 67,73 -----
  945. X  
  946. X      long dsize = getsval(4, fp);
  947. X      debug(4, "PK designsize=%ld", dsize);
  948. !     // do not bother checking the designsize - it seems pointless
  949. X  
  950. X      // check the checksum
  951. X      long check = getuval(4, fp);
  952. *** tmp/readfont.C    Mon May 20 15:12:45 1991
  953. --- readfont.C    Tue Oct 22 10:13:23 1991
  954. ***************
  955. *** 1,5
  956. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  957. ! static const char rcsid[] = "$Header: readfont.C,v 1.22 91/05/20 16:12:46 hmgr Exp $";
  958. X  
  959. X  // read font data from the METAFONT GF (generic font) files
  960. X  //
  961. X
  962. --- 1,5 -----
  963. X  // Copyright (c) 1991 by Parag Patel.  All Rights Reserved.
  964. ! static const char rcsid[] = "$Header: readfont.C,v 1.24 91/10/22 11:13:21 hmgr Exp $";
  965. X  
  966. X  // read font data from the METAFONT GF (generic font) files
  967. X  //
  968. ***************
  969. *** 4,9
  970. X  // read font data from the METAFONT GF (generic font) files
  971. X  //
  972. X  // by Parag Patel
  973. X  
  974. X  #include "defs.h"
  975. X  
  976. X
  977. --- 4,11 -----
  978. X  // read font data from the METAFONT GF (generic font) files
  979. X  //
  980. X  // by Parag Patel
  981. + //
  982. + // MF_SCRIPT hacks by Peter Marvit
  983. X  
  984. X  #include "defs.h"
  985. X  
  986. ***************
  987. *** 90,96
  988. X  // the information from the DVI file - we now have to actually read the
  989. X  // font file (GF or PK) to get the rest of the font's description
  990. X  // 
  991. ! void setupfont(font &f)
  992. X  {
  993. X      if (f.path != NULL)
  994. X      if (tryfile(f, f.path, "", f.basename, ""))
  995. X
  996. --- 92,98 -----
  997. X  // the information from the DVI file - we now have to actually read the
  998. X  // font file (GF or PK) to get the rest of the font's description
  999. X  // 
  1000. ! static boolean trysetupfont(font &f)
  1001. X  {
  1002. X      if (f.path != NULL)
  1003. X      if (tryfile(f, f.path, "", f.basename, ""))
  1004. ***************
  1005. *** 94,100
  1006. X  {
  1007. X      if (f.path != NULL)
  1008. X      if (tryfile(f, f.path, "", f.basename, ""))
  1009. !         return;
  1010. X  
  1011. X      // setup the font directory cache if we need to
  1012. X      if (pathlist.size() < 1)
  1013. X
  1014. --- 96,102 -----
  1015. X  {
  1016. X      if (f.path != NULL)
  1017. X      if (tryfile(f, f.path, "", f.basename, ""))
  1018. !         return TRUE;
  1019. X  
  1020. X      // setup the font directory cache if we need to
  1021. X      if (pathlist.size() < 1)
  1022. ***************
  1023. *** 105,111
  1024. X      Pathent & p = pathlist[i];
  1025. X  
  1026. X      if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ".pk"))
  1027. !         return;
  1028. X      if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ".gf"))
  1029. X          return;
  1030. X      if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ""))
  1031. X
  1032. --- 107,113 -----
  1033. X      Pathent & p = pathlist[i];
  1034. X  
  1035. X      if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ".pk"))
  1036. !         return TRUE;
  1037. X      if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ".gf"))
  1038. X          return TRUE;
  1039. X      if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ""))
  1040. ***************
  1041. *** 107,113
  1042. X      if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ".pk"))
  1043. X          return;
  1044. X      if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ".gf"))
  1045. !         return;
  1046. X      if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ""))
  1047. X          return;
  1048. X      if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ""))
  1049. X
  1050. --- 109,115 -----
  1051. X      if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ".pk"))
  1052. X          return TRUE;
  1053. X      if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ".gf"))
  1054. !         return TRUE;
  1055. X      if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ""))
  1056. X          return TRUE;
  1057. X      if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ""))
  1058. ***************
  1059. *** 109,115
  1060. X      if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ".gf"))
  1061. X          return;
  1062. X      if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ""))
  1063. !         return;
  1064. X      if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ""))
  1065. X          return;
  1066. X  
  1067. X
  1068. --- 111,117 -----
  1069. X      if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ".gf"))
  1070. X          return TRUE;
  1071. X      if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ""))
  1072. !         return TRUE;
  1073. X      if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ""))
  1074. X          return TRUE;
  1075. X  
  1076. ***************
  1077. *** 111,117
  1078. X      if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ""))
  1079. X          return;
  1080. X      if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ""))
  1081. !         return;
  1082. X  
  1083. X      char ext[30];
  1084. X      sprintf(ext, ".%dpk", RESOLUTION);
  1085. X
  1086. --- 113,119 -----
  1087. X      if (tryfile(f, p.path, gfmagdir(p.dirs, f.mag), f.basename, ""))
  1088. X          return TRUE;
  1089. X      if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ""))
  1090. !         return TRUE;
  1091. X  
  1092. X      char ext[30];
  1093. X      sprintf(ext, ".%dpk", RESOLUTION);
  1094. ***************
  1095. *** 116,122
  1096. X      char ext[30];
  1097. X      sprintf(ext, ".%dpk", RESOLUTION);
  1098. X      if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ext))
  1099. !         return;
  1100. X      sprintf(ext, ".%dgf", RESOLUTION);
  1101. X      if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ext))
  1102. X          return;
  1103. X
  1104. --- 118,124 -----
  1105. X      char ext[30];
  1106. X      sprintf(ext, ".%dpk", RESOLUTION);
  1107. X      if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ext))
  1108. !         return TRUE;
  1109. X      sprintf(ext, ".%dgf", RESOLUTION);
  1110. X      if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ext))
  1111. X          return TRUE;
  1112. ***************
  1113. *** 119,125
  1114. X          return;
  1115. X      sprintf(ext, ".%dgf", RESOLUTION);
  1116. X      if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ext))
  1117. !         return;
  1118. X      }
  1119. X      quit("Cannot find font file \"%s\" (at or near magnification %ld.%03ld) anywhere",
  1120. X          f.basename, f.mag / 1000, f.mag % 1000);
  1121. X
  1122. --- 121,127 -----
  1123. X          return TRUE;
  1124. X      sprintf(ext, ".%dgf", RESOLUTION);
  1125. X      if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ext))
  1126. !         return TRUE;
  1127. X      }
  1128. X      return FALSE;
  1129. X  }
  1130. ***************
  1131. *** 121,126
  1132. X      if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ext))
  1133. X          return;
  1134. X      }
  1135. X      quit("Cannot find font file \"%s\" (at or near magnification %ld.%03ld) anywhere",
  1136. X          f.basename, f.mag / 1000, f.mag % 1000);
  1137. X  }
  1138. X
  1139. --- 123,245 -----
  1140. X      if (tryfile(f, p.path, pkmagdir(p.dirs, f.mag), f.basename, ext))
  1141. X          return TRUE;
  1142. X      }
  1143. +     return FALSE;
  1144. + }
  1145. + #ifdef MF_SCRIPT
  1146. + // The following routine is cribbed (with permission) from the fine "dvips"
  1147. + // package by Tomas Rokicki at Stanford U.
  1148. + //
  1149. + static int magstep(int n, int bdpi)
  1150. + {
  1151. +     register float t;
  1152. +     int neg = 0;
  1153. +     if (n < 0)
  1154. +     {
  1155. +     neg = 1;
  1156. +     n = -n;
  1157. +     }
  1158. +     if (n & 1)
  1159. +     {
  1160. +     n &= ~1;
  1161. +     t = 1.095445115;
  1162. +     }
  1163. +     else
  1164. +     t = 1.0;
  1165. +     while (n > 8)
  1166. +     {
  1167. +     n -= 8;
  1168. +     t = t * 2.0736;
  1169. +     }
  1170. +     while (n > 0)
  1171. +     {
  1172. +     n -= 2;
  1173. +     t = t * 1.2;
  1174. +     }
  1175. +     if (neg)
  1176. +     return (int)(0.5 + bdpi / t);
  1177. +     else
  1178. +     return (int)(0.5 + bdpi * t);
  1179. + }
  1180. + #endif
  1181. + // Try to get and set the fonts we need.  If it fails, it probably means 
  1182. + // we can't find the fonts and will have to make them.  The #ifdef MF_SCRIPT 
  1183. + // allows an attempted creation of fonts, using an extrenal script which 
  1184. + // should call MetaFont, and then a retry of the [hopefully created] fonts.
  1185. + //
  1186. + void setupfont(font &f)
  1187. + {
  1188. +     if (trysetupfont(f))
  1189. +     return;
  1190. + #ifdef MF_SCRIPT
  1191. +     // The following code is cribbed (with permission) from the fine "dvips"
  1192. +     // package by Tomas Rokicki at Stanford U.
  1193. +     //
  1194. +     // First, the computation of magstep, stolen from dvips (makefont.c).
  1195. +     // This entire routine carefully lifted, though it works fine.
  1196. +     // 
  1197. +     int m, n, dpi, bdpi;
  1198. +     char magstepc[MAXPATHLEN + 1];
  1199. +     bdpi = RESOLUTION;
  1200. +     dpi = (int)f.mag * RESOLUTION / 1000;
  1201. +     m = 0;
  1202. +     if (dpi < bdpi)
  1203. +     {
  1204. +     while (1)
  1205. +     {
  1206. +         m--;
  1207. +         n = magstep(m, bdpi);
  1208. +         if (n == dpi)
  1209. +         break;
  1210. +         if (n < dpi || m < -40)
  1211. +         {
  1212. +         m = 9999;
  1213. +         break;
  1214. +         }
  1215. +     }
  1216. +     }
  1217. +     else if (dpi > bdpi)
  1218. +     {
  1219. +     while (1)
  1220. +     {
  1221. +         m++;
  1222. +         n = magstep(m, bdpi);
  1223. +         if (n == dpi)
  1224. +         break;
  1225. +         if (n > dpi || m > 40)
  1226. +         {
  1227. +         m = 9999;
  1228. +         break;
  1229. +         }
  1230. +     }
  1231. +     }
  1232. +     if (m == 9999)
  1233. +     {
  1234. +     (void)sprintf(magstepc, "%d+%d/%d", dpi / bdpi, dpi % bdpi, bdpi);
  1235. +     }
  1236. +     else if (m >= 0)
  1237. +     {
  1238. +     (void)sprintf(magstepc, "magstep\\(%d.%d\\)", m / 2, (m & 1) * 5);
  1239. +     }
  1240. +     else
  1241. +     {
  1242. +     (void)sprintf(magstepc, "magstep\\(-%d.%d\\)", (-m) / 2, (m & 1) * 5);
  1243. +     }
  1244. +     // Here is where we do the actually calling of the external script
  1245. +     // 
  1246. +     char buf[MAXPATHLEN + 1];
  1247. +     sprintf(buf, "%s %s %d %d %s\n", MF_SCRIPT, f.basename,
  1248. +         dpi, bdpi, magstepc);
  1249. +     system(buf);
  1250. +     if (trysetupfont(f))
  1251. +     return;
  1252. + #endif
  1253. X      quit("Cannot find font file \"%s\" (at or near magnification %ld.%03ld) anywhere",
  1254. X          f.basename, f.mag / 1000, f.mag % 1000);
  1255. X  }
  1256. SHAR_EOF
  1257. chmod 0644 patch-1.7-1.8 ||
  1258. echo 'restore of patch-1.7-1.8 failed'
  1259. Wc_c="`wc -c < 'patch-1.7-1.8'`"
  1260. test 34592 -eq "$Wc_c" ||
  1261.     echo 'patch-1.7-1.8: original size 34592, current size' "$Wc_c"
  1262. fi
  1263. # ============= MakeTeXPK ==============
  1264. if test -f 'MakeTeXPK' -a X"$1" != X"-c"; then
  1265.     echo 'x - skipping MakeTeXPK (File already exists)'
  1266. else
  1267. echo 'x - extracting MakeTeXPK (Text)'
  1268. sed 's/^X//' << 'SHAR_EOF' > 'MakeTeXPK' &&
  1269. #!/bin/sh -x
  1270. #   @(#)$Header: MakeTeXPK,v 1.2 91/08/19 17:53:48 hmgr Exp $
  1271. #   @(#)Based on labrea.stanford.edu:/pub/dvips547.tar.Z dated Jan 27 02:14 size 244319
  1272. #
  1273. #   This script file makes a new TeX PK font, because one wasn't
  1274. #   found.  Parameters are:
  1275. #
  1276. #   name dpi bdpi magnification [mode]
  1277. #
  1278. #   `name' is the name of the font, such as `cmr10'.  `dpi' is
  1279. #   the resolution the font is needed at.  `bdpi' is the base
  1280. #   resolution, useful for figuring out the mode to make the font
  1281. #   in.  `magnification' is a string to pass to MF as the
  1282. #   magnification.  `mode', if supplied, is the mode to use.
  1283. #
  1284. #   Note that this file must execute Metafont, and then gftopk,
  1285. #   and place the result in the correct location for the PostScript
  1286. #   driver to find it subsequently.  If this doesn't work, it will
  1287. #   be evident because MF will be invoked over and over again.
  1288. #
  1289. #   Of course, it needs to be set up for your site.
  1290. #
  1291. # TEMPDIR needs to be unique for each process because of the possibility
  1292. # of simultaneous processes running this script.
  1293. TEMPDIR=/tmp/mtpk.$$
  1294. NAME=$1
  1295. DPI=$2
  1296. BDPI=$3
  1297. MAG=$4
  1298. MODE=$5
  1299. X
  1300. umask 0
  1301. X
  1302. if test "$MODE" = ""
  1303. then
  1304. X   if test $BDPI = 300
  1305. X   then
  1306. X      MODE=laser
  1307. X   elif test $BDPI = 1270
  1308. X   then
  1309. X      MODE=lino
  1310. X   else
  1311. X      echo "I don't know the mode for $BDPI"
  1312. X      echo "Have your system admin update MakeTeXPK"
  1313. X      exit 1
  1314. X   fi
  1315. fi
  1316. X
  1317. #  Something like the following is useful with TeX from hpdtl.ctgsc.hp.com
  1318. PATH=$PATH:/usr/lib/tex/bin
  1319. MFINPUTS=/usr/lib/tex/cm:/usr/lib/tex/mf:/usr/lib/tex/macros
  1320. export MFINPUTS
  1321. MAGDIR=`dc <<!
  1322. 4 k $DPI $BDPI / .0005 + 1000 * 0 k 1 / 3 k 1000 / p
  1323. !
  1324. `
  1325. DESTDIR=/usr/lib/tex/fontbits/$MODE/$MAGDIR
  1326. GFNAME=$NAME.$DPI'gf'
  1327. PKNAME=$NAME.'pk'
  1328. X
  1329. # Clean up on normal or abnormal exit
  1330. trap "cd /; rm -rf $TEMPDIR $DESTDIR/pktmp.$$" 0 1 2 15
  1331. X
  1332. X
  1333. if test ! -d $DESTDIR
  1334. then
  1335. X   mkdir $DESTDIR
  1336. fi
  1337. X
  1338. mkdir $TEMPDIR
  1339. cd $TEMPDIR
  1340. X
  1341. if test -r $DESTDIR/$PKNAME
  1342. then
  1343. X   echo "$DESTDIR/$PKNAME already exists!"
  1344. X   exit 0
  1345. fi
  1346. X
  1347. echo cmmf "\mode:=$MODE; mag:=$MAG; scrollmode; input $NAME" \\\</dev/null
  1348. cmmf "\mode:=$MODE; mag:=$MAG; scrollmode; input $NAME" </dev/null
  1349. if test ! -r $GFNAME
  1350. then
  1351. X   echo "Metafont failed for some reason on $GFNAME"
  1352. X   exit 1
  1353. fi
  1354. X
  1355. gftopk $GFNAME $PKNAME
  1356. X
  1357. # Install the PK file carefully, since others may be doing the same
  1358. # as us simultaneously.
  1359. X
  1360. mv $PKNAME $DESTDIR/pktmp.$$
  1361. cd $DESTDIR
  1362. mv pktmp.$$ $PKNAME
  1363. X
  1364. Xexit 0
  1365. SHAR_EOF
  1366. chmod 0555 MakeTeXPK ||
  1367. echo 'restore of MakeTeXPK failed'
  1368. Wc_c="`wc -c < 'MakeTeXPK'`"
  1369. test 2396 -eq "$Wc_c" ||
  1370.     echo 'MakeTeXPK: original size 2396, current size' "$Wc_c"
  1371. fi
  1372. exit 0
  1373.  
  1374. exit 0 # Just in case...
  1375. -- 
  1376. Kent Landfield                   INTERNET: kent@sparky.IMD.Sterling.COM
  1377. Sterling Software, IMD           UUCP:     uunet!sparky!kent
  1378. Phone:    (402) 291-8300         FAX:      (402) 291-4362
  1379. Please send comp.sources.misc-related mail to kent@uunet.uu.net.
  1380.